\chapter{Architecture}
The CEAB++ system is designed using a multi-layered client-server architecture.
The system can best be described as a two-tier thin-client model --i.e. the
client is responsible only for running the presentation software, while the
server handles all data management and application
processing~\cite{ref:sommerville}. In this case the user will be accessing the
web application through a browser, and the server will be processing and
managing all the data. `Rich client' behaviour and interactivity is provided by
means of AJAX (Asynchronous Javascript And XML) callbacks to a JSON API running
on the remote server. While this leads to an increased processing load on the
server, the small volume of data being transmitted for each callback ensures
that minimal overhead is required to provide the user with a much more
responsive and rich user interface, making the architecture an appropriate
choice given the system's user interface requirements. A graphical
representation of this client-server architecture can be seen in Figure
\ref{fig:clientserver}.

\begin{figure}[h]
\centering
\includegraphics[scale=0.5]{images/clientserver}
\caption{Client-Server Architecture}
\label{fig:clientserver}
\end{figure}

The ``layered'' portion of the architecture is largely provided by employing
the Django web application framework. Django loosely follows the
Model-View-Controller (MVC) architectural pattern; however, the methodology in
the Django framework differs slightly from the traditional definition of the
MVC architecture. In Django, the `view' represents the callback function for a
particular URL. The presentation layer is referred to as the `template', which
handles \textit{how} the data is presented--as opposed to to the view, which
determines \textit{what} is presented~\cite{ref:django}.  The controller is
responsible for routing requests and user input to the appropriate view; this
is handled entirely by the framework, and is not modified by the programmer in
any way. The model layer contains database access code for persistent storage
and any business logic that pertains to an individual entity (model class).
Despite the differences in terminology, the Django MVC system also provides
facilities for decoupling business logic, persistence, and presentation code
from one another, providing a clear separation of concerns between software
modules in the CEAB++ system. A graphical representation of the layered MVC
architecture provided by Django can be seen in Figure \ref{fig:mvc}.

\begin{figure}[h]
\centering
\includegraphics[scale=0.5]{images/mvc}
\caption{Model-View-Controller Architecture}
\label{fig:mvc}
\end{figure}
